package com.wyk.controller;

import com.wyk.domain.CommonResult;
import com.wyk.serice.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @author WangYuKai
 * @Date 2022/8/5
 * @apiNote
 */
@RestController
public class AccountController {

    @Autowired
    private AccountService service;

    @PostMapping("/account/decrease")
    public CommonResult decrease(@RequestParam("userId")Long userId, @RequestParam("money") BigDecimal money){
        int i = service.updateMoney(userId, money);
        if(i != 0){
            return new CommonResult(200,"更改成功");
        }
        return new CommonResult(400,"更改失败");
    }
}
